package org.jackysoft.struts2.assets;
import java.util.Collection;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Namespace;
import org.jackysoft.entity.Department;
import org.jackysoft.entity.SparePart;
import org.jackysoft.service.SparePartService;
import org.jackysoft.struts2.UtilsCRUDAction;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;



@Namespace("/sparepart")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class SparePartAction extends UtilsCRUDAction<SparePart> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 7023156945001181692L;
	private SparePartService service;
	private SparePart bean;
	private Collection<SparePart> beans;	
	private Department owner;
	
	
	public String stat() throws Exception{
		
		pager = service.statByDate(usedate);
		return "stat";
	}
	
	public String statdetail() throws Exception{
		pager = service.statByOwner(getOwner(),usedate, page, 10);
		
		return "statdetail";
	}
	
	
	public void setBean(SparePart bean){
	     this.bean = bean;
	}
	public SparePart getBean(){
	     return this.bean;
	}
	public void setBeans(Collection<SparePart> beans){
	
	     this.beans = beans;
	}
	public Collection<SparePart> getBeans(){
	     return this.beans;
	}
	
	@Resource
	public void setService(SparePartService service) {
		this.service = service;
		this.setDataProvider(service);
	}	
	
	public SparePartService getService(){
	   return this.service;
	}

	public Department getOwner() {
		return owner;
	}

	public void setOwner(Department owner) {
		this.owner = owner;
	}
		
}